<?php
namespace frontend\controllers;

use frontend\models\Banner;
use common\components\FrontBaseController;
use Yii;
use \common\helps\tools;
use \common\helps\code;
/**
 * Banner controller
 */
class BannerController extends FrontBaseController
{

    public $modelClass = 'frontend\models\Banner';
    public function init()
    {
        parent::init();
    }

    /**
     * 获取banner列表
     * @author hey_heyang(635870453@qq.com)
     * @return json
     */
    public  function  actionGetBannerList(){
        $request =$this->request;
        $model = new Banner();
        $params = $request->queryParams;
        if(empty($params['mid'])) return code::error('error','参数错误');
        $data = $model->getBannerList($params);
        $data = tools::getPageData($data,empty($params['page_size'])?'':$params['page_size'],empty($params['page'])?'':$params['page']);

        return code::success($data);

    }


    /**
     * 获取banner分类列表
     * @author hey_heyang(635870453@qq.com)
     * @return json
     */
    public  function  actionGetBannerClassList(){
        $model = new Banner();
        $total_data = $model->getBannerClassList();

        return code::success($total_data);

    }

}
